home *** CD-ROM | disk | FTP | other *** search
Wrap
// ---------------------------------------------------------------------- // Copyright ⌐ 1995, National Education Training Group, Inc. - // All rights reserved. - // - // Skill Builder 4.01 Course Removal by Carol Townsend - //----------------------------------------------------------------------- //----------------------------------------------------------------------- // Set predefined constants. - //----------------------------------------------------------------------- #define MAX_SIZE 255 declare // Must use declare keyword to start variable declaration string szText[256], szDisk[20], DelCourse[10], szBitmapPath[50], szResultPath[MAX_SIZE], szTitle[50], svCmdLine[MAX_SIZE], szItemName[150], szErrFile[MAX_SIZE], szWinDirectory[144], szTotal[20], szDefPath[50], szRemove[25], szResult[10], szDelDir[MAX_SIZE], NameNum[10], szCount[3], OldCourse[10], szCommandLine[MAX_SIZE], szCommandLine2[MAX_SIZE], svDisk[5], svWrkDir[MAX_SIZE], svIconPath[MAX_SIZE], svShortCutKey[50], szSBDir[25], szWinINI[144], szUserPath[80], szUserFile[10], szVersion[10], szMediaType[10], szMessageFile [50]; INT bFound // Flag is set when DelCourse is found in course section // of NETG.INI. This prevents lost courses if remove // is run more than once for a 4.0 CD course. number nTotal, nnew, nvIconIndex, nCount, nvMinimizeFlag; LONG lResult; LIST listID; program /* Must use program keyword to start the statements */ Start: GetDisk ( SRCDIR, svDisk ); // szBitmapPath = svDisk ^ "INSTALL"; // szBitmapPath = szBitmapPath ^ "NETGLOG8.BMP"; // PlaceBitmap( szBitmapPath, 101, 20, 20, UPPER_RIGHT ); szBitmapPath = SUPPORTDIR ^ "NETGLOG8.BMP"; szMessageFile = SUPPORTDIR ^ "MESSAGES.INI"; PlaceBitmap( szBitmapPath, 1, CENTERED, CENTERED, CENTERED ); SetColor( BACKGROUND, RGB(255,255,255) ); // Set the color of the background to be BLUE //SetColor( BACKGROUND, RGB( 0,0,255 ) ); SetColor( STATUSBAR, RED ); SetFont( FONT_TITLE, STYLE_NORMAL, "Helv" ); Enable( BACKGROUND ); //Enable( STATUS ); szTitle = "Skill Builder « Removal"; SetTitle( szTitle, 18, WHITE ); SetStatusWindow( 1, szTitle ); // In Info Window to display the file1.lis SetInfoWindow( "Information ", "file1.lis" ); // Enable various objects. Disable( HELP ); // Enable( EXIT ); // Exit Button Disable( PAUSE ); // Pause Button //Enable( TEXT ); // Info Windows Disable( STATUS ); // Status , % Complete Bar Window Disable( TEXT ); // Info Windows Disable( FEEDBACK_FULL); // Feedback window enabled GetSystemInfo(VIDEO, nvIconIndex, svWrkDir); if ((nvIconIndex = IS_UVGA) | (nvIconIndex = IS_UNKNOWN)) then PlaceWindow( STATUS, 300, 70, LOWER_RIGHT); elseif (nvIconIndex = IS_XVGA) then PlaceWindow( STATUS, 250, 30, LOWER_RIGHT); else PlaceWindow( STATUS, CENTERED, CENTERED, CENTERED); endif; //--------------------------------------------------------------------- // This procedure accepts the Course Number from user - //--------------------------------------------------------------------- COURSENUM: szResultPath = svDisk ^ "INSTALL" ^ "INSTALL.INI"; if (GetProfString (szResultPath, "course", "number", DelCourse) != 0) then goto BadInstallINI; endif; if (GetProfString (szResultPath, "install", "ver", szVersion) != 0) then goto BadInstallINI; endif; if (GetProfString (szResultPath, "install", "type", szMediaType) != 0) then goto BadInstallINI; endif; StrToUpper (szMediaType, szMediaType); if ((szVersion < "4.0") | (szMediaType != "CD")) then SetDialogTitle( DLG_ASK_TEXT, "Enter course number" ); szText = "Please enter the course number \nyou wish to remove. "; DelCourse = ""; AskText( szText, DelCourse, DelCourse ); if LAST_RESULT = FALSE then goto ConfirmCancel; endif; else Enable(STATUS); SetStatusWindow (20, szTitle); endif; //--------------------------------------------------------------------- // This procedure gets the Disk letter from NETG.INI and - // defines the course and SB sub-directories. - //--------------------------------------------------------------------- TARGETLOC: FindFile( WINDIR, "NETG.INI", szResult ); if LAST_RESULT != 0 then call MISSING_INI; endif; //----------------------------------------------------------------- // Defines a path to the NETG.INI file using a variable - //----------------------------------------------------------------- szWinDirectory = WINDIR; szWinDirectory = szWinDirectory ^ "NETG.INI"; GetProfString( szWinDirectory, DelCourse, "Path", szDefPath ); szDefPath = szDefPath ^ "\\"; GetDisk( szDefPath, szDisk ); szDefPath = szDefPath ^ "SKILLB"; szSBDir = szDefPath; szDefPath = szDefPath ^ DelCourse; if ((szVersion > "4.0") & (szMediaType = "CD")) then SetStatusWindow (40, szTitle); call CheckCD40LM; szDelDir = szDefPath; SetStatusWindow (60, szTitle); goto NETGINI; else ExistsDir( szDefPath ); if LAST_RESULT = EXISTS then goto REMOVECOURSE; endif; szText = "Course, "; szText = szText + DelCourse; szText = szText + ", does not exist on this system.\nPress OK to return to the course selection."; MessageBox( szText, WARNING ); szDefPath = ""; // Reset Default path goto COURSENUM; endif; //--------------------------------------------------------------------- // This procedure removes all course files & sub-directories - //--------------------------------------------------------------------- REMOVECOURSE: Enable( STATUS ); // Status , % Complete Bar Window // Enable( TEXT ); // Info Windows Enable( FEEDBACK_FULL); // Feedback window enabled GetProfString( szWinDirectory, DelCourse, "UserPath", szUserPath ); if (szUserPath = szDefPath ^ "PRESENT" | szUserPath = szDefPath ^ "ICONWARE" | szUserPath = szDefPath | szUserPath = szDefPath ^ "PICS_ENU" | szUserPath = szDefPath ^ "INPUT" | szUserPath = szDefPath ^ "INPUT" | szUserPath = szDefPath ^ "VAR_ENU" | szUserPath = szDefPath ^ "TEXT_ENU" ) then SetInfoWindow( "Information ", "file2.lis" ); SetDialogTitle( DLG_ASK_YESNO, "Delete Learner Management Files" ); AskYesNo ("Learner Management files have been installed in the coures subdirectory. Are you sure that you want to remove the course with these files?", NO ); if ( LAST_RESULT = NO ) then szText = "To save Learner Management files, move these files to a non-course directory. The files are currently in the "; szText = szText + szUserPath; szText = szText + "\ directory."; MessageBox (szText, INFORMATION); exit; endif; endif; SetInfoWindow( "Information ", "file1.lis" ); ChangeDirectory( szDisk ^ "\\" ); // Allows removal if user is in // course directory. szDelDir = szDefPath; szDefPath = szDefPath ^ "PRESENT"; SetStatusWindow( 15, "Removing PRESENT" ); DeleteDir( szDefPath, ALLCONTENTS ); ExistsDir( szDefPath ); if LAST_RESULT = EXISTS then goto BAD_REMOVE; endif; szDefPath = szDelDir; szDefPath = szDefPath ^ "ICONWARE"; SetStatusWindow( 30, "Removing ICONWARE" ); DeleteDir( szDefPath, ALLCONTENTS ); ExistsDir( szDefPath ); if LAST_RESULT = EXISTS then goto BAD_REMOVE; endif; szDefPath = szDelDir; szDefPath = szDefPath ^ "PICS_ENU"; SetStatusWindow( 45, "Removing GRAPHICS" ); DeleteDir( szDefPath, ALLCONTENTS ); ExistsDir( szDefPath ); if LAST_RESULT = EXISTS then goto BAD_REMOVE; endif; szDefPath = szDelDir; szDefPath = szDefPath ^ "INPUT"; SetStatusWindow( 60, "Removing INPUT" ); DeleteDir( szDefPath, ALLCONTENTS ); ExistsDir( szDefPath ); if LAST_RESULT = EXISTS then goto BAD_REMOVE; endif; szDefPath = szDelDir; szDefPath = szDefPath ^ "VAR_ENU"; SetStatusWindow( 65, "Removing VAR_ENU" ); DeleteDir( szDefPath, ALLCONTENTS ); ExistsDir( szDefPath ); if LAST_RESULT = EXISTS then goto BAD_REMOVE; endif; szDefPath = szDelDir; szDefPath = szDefPath ^ "TEXT_ENU"; SetStatusWindow( 70, "Removing TEXT_ENU" ); DeleteDir( szDefPath, ALLCONTENTS ); ExistsDir( szDefPath ); if LAST_RESULT = EXISTS then goto BAD_REMOVE; endif; szDefPath = szDelDir; szText = "Removing course sub-directory "; szText = szText + DelCourse; SetStatusWindow( 95, szText ); DeleteDir( szDefPath, ALLCONTENTS ); ExistsDir( szDefPath ); if LAST_RESULT = EXISTS then goto BAD_REMOVE; endif; //---------------------------------------------------------------------- // Delete VSI batch file for running the course. //---------------------------------------------------------------------- TARGETDIR = "C:\\"; DeleteFile ( DelCourse + ".BAT" ); //---------------------------------------------------------------------- // Updates NETG.INI file - if this is the last course on the - // system, NETG.INI and the SB movie are deleted. - //---------------------------------------------------------------------- SetStatusWindow( 98, "Updating NETG.INI" ); NETGINI: GetProfInt( szWinDirectory, "Course", "Total", nTotal ); bFound = FALSE; if nTotal = 1 then //delete NETG.INI, Skill Builder Movie, and the Icon Sounds //7/31/95 moved deletion of movie and wav files to next 'if' // to prevent drive read errors for CD 4.0 removals. TARGETDIR = WINDIR; DeleteFile( "NETG.INI" ); //delete NETG sounds from WIN.INI szWinINI = WINDIR ^ "WIN.INI"; WriteProfString (szWinINI, "Sounds", "NETGRewind", "" ); WriteProfString (szWinINI, "Sounds", "NETGForward", "" ); WriteProfString (szWinINI, "Sounds", "NETGFForward", "" ); WriteProfString (szWinINI, "Sounds", "NETGMap", "" ); WriteProfString (szWinINI, "Sounds", "NETGExit", "" ); WriteProfString (szWinINI, "Sounds", "NETG4Rewind", "" ); WriteProfString (szWinINI, "Sounds", "NETG4Forward", "" ); WriteProfString (szWinINI, "Sounds", "NETG4FForward", "" ); WriteProfString (szWinINI, "Sounds", "NETG4Map", "" ); WriteProfString (szWinINI, "Sounds", "NETG4Exit", "" ); if ((szVersion > "4.0") & (szMediaType = "CD")) then szText = "This is the last Skill Builder course on your system. Do you want to delete the program group from Windows?"; if ( AskYesNo (szText, YES) = YES ) then DeleteGroup ("NETG SB Courseware"); endif; else TARGETDIR = szSBDir; DeleteFile ( "SBMOVIE*.FLI" ); DeleteFile ( "*.WAV" ); call Delete_SB_Directory; endif; else nnew = 1; for nCount = 1 to nTotal NameNum = "Name"; NumToStr( szCount, nCount ); // Build NAMEn Keyname NameNum = NameNum + szCount; GetProfString( szWinDirectory, "Course", NameNum, OldCourse ); StrCompare( OldCourse, DelCourse ); // Course to Delete ? if LAST_RESULT = 0 then // Delete course entry from Course App. Section NETG.INI WriteProfString( szWinDirectory, "Course", NameNum, "" ); bFound = TRUE; else NameNum = "Name"; NumToStr( szCount, nnew ); // Build new NAMEn Keyname NameNum = NameNum + szCount; WriteProfString( szWinDirectory, "Course", NameNum, OldCourse ); nnew = nnew + 1; endif; endfor; if bFound = TRUE then NameNum = "Name"; NumToStr( szCount, nTotal ); // Delete Extra NAMEn Keyname NameNum = NameNum + szCount; WriteProfString( szWinDirectory, "Course", NameNum, "" ); endif; // Delete Course Specific area from NETG.INI WriteProfString( szWinDirectory, DelCourse, "", ""); WriteProfString( szWinDirectory, "Course", "Total", "" ); if bFound = TRUE then nTotal = nTotal - 1; endif; NumToStr( szTotal, nTotal ); if LAST_RESULT = 0 then WriteProfString( szWinDirectory, "Course", "Total", szTotal ); else MessageBox("Missing or corrupted NETG.INI,\n You must reinstall all skill builder courseware for proper execution", INFORMATION); endif; endif; //--------------------------------------------------------------------- // Check for removal of course //--------------------------------------------------------------------- if ((szVersion < "4.0") | (szMediaType != "CD")) then GetDisk( szDefPath, szDisk ); ExistsDir( szDelDir ); if LAST_RESULT = EXISTS then goto BAD_REMOVE; endif; else SetStatusWindow (80, szTitle); endif; //--------------------------------------------------------------------- // Remove course icon from NETG SB Courseware group //--------------------------------------------------------------------- szCommandLine = szDelDir ^ "PRESENT\\PRESENT"; szCommandLine = szCommandLine + " "; szCommandLine = szCommandLine + szDelDir; szCommandLine = szCommandLine ^ "ICONWARE"; szCommandLine = szCommandLine ^ DelCourse; szCommandLine = szCommandLine + ".IW"; szCommandLine2 = szDelDir ^ "PRESENT\\PRESENT"; szCommandLine2 = szCommandLine2 + " .."; szCommandLine2 = szCommandLine2 ^ "ICONWARE"; szCommandLine2 = szCommandLine2 ^ DelCourse; szCommandLine2 = szCommandLine2 + ".IW"; listID = ListCreate( STRINGLIST ); GetItemNameList ("NETG SB Courseware", listID ); if (ListGetFirstString( listID,szItemName ) != END_OF_LIST) then QueryProgItem( "NETG SB Courseware", szItemName, svCmdLine, svWrkDir, svIconPath, nvIconIndex, svShortCutKey, nvMinimizeFlag ); if szCommandLine = svCmdLine then call DeleteIcon; endif; if szCommandLine2 = svCmdLine then szCommandLine2 = szCommandLine; call DeleteIcon; endif; while (lResult != END_OF_LIST ) lResult = ListGetNextString( listID, szItemName ); QueryProgItem( "NETG SB Courseware", szItemName, svCmdLine, svWrkDir, svIconPath, nvIconIndex, svShortCutKey, nvMinimizeFlag ); if szCommandLine = svCmdLine then // MessageBox (szItemName, INFORMATION); call DeleteIcon; elseif szCommandLine2 = svCmdLine then call DeleteIcon; endif; endwhile; endif; ListDestroy (listID); Delay( 3 ); //Artificial Delay SetStatusWindow( 100, "Removal Complete" ); MessageBox( "Removal complete.\nPress OK to exit.", INFORMATION ); goto EXIT_IT; BAD_REMOVE: MessageBox( "Removal did not complete correctly.\n Please Check for courseware files.", SEVERE ); goto EXIT_IT; MISSING_INI: MessageBox( "Missing NETG.INI,\n You must reinstall all Skill Builder courseware for proper execution", INFORMATION); goto EXIT_IT; BadInstallINI: MessageBox( "There is a problem with the INSTALL.INI file. Course has not been removed.", SEVERE); goto EXIT_IT; EXIT_IT: exit; //Exit removal program. //--------------------------------------------------------------------- // This procedure will confirm with the users if they - // want to terminate the removal of the course. - //--------------------------------------------------------------------- ConfirmCancel: AskYesNo( "Are you sure you want to CANCEL Remove?", FALSE ); if LAST_RESULT = FALSE then goto COURSENUM; endif; exit; DeleteIcon: ShowGroup( "NETG SB Courseware", SW_SHOWMINNOACTIVE ); ShowGroup( "NETG SB Courseware", SW_NORMAL ); DeleteProgItem ( "NETG SB Courseware", szItemName, ""); return; Delete_SB_Directory: szText = "This is the last Skill Builder course on your system. Do you want to delete all the files in the Skill Builder directory and the program group from Windows?"; if ( AskYesNo( szText, YES) = NO ) then return; else DeleteGroup ("NETG SB Courseware"); if (FindFile( szSBDir, "NE_USERS.FMT", szText ) = 0) then szText = "Learner Management files were found in the Skill Builder directory. Do you wish to leave the directory with these files?"; if ( AskYesNo( szText, YES) = YES ) then return; endif; endif; DeleteDir (szSBDir, ALLCONTENTS ); endif; return; CheckCD40LM: GetProfString (szWinDirectory, DelCourse, "UserPath", szUserPath); CopyBytes (szText, 0, DelCourse, 0, 2); szUserFile = "000" + szText; szUserFile = szUserFile + "."; CopyBytes (szText, 0, DelCourse, 2, 3); szUserFile = szUserFile + szText; if (FindFile (szUserPath, szUserFile, szResult) = 0) then SetDialogTitle (DLG_ASK_YESNO, "Delete Learner Management Files"); AskYesNo ("Do you want to delete the Learner Management File for the course?", NO); if LAST_RESULT = YES then TARGETDIR = szUserPath; DeleteFile (szUserFile); endif; endif; return; // ---------------------------------------------------------------------- // Copyright 1995 - National Education Training Group - // Skill Builder Course Removal - //-----------------------------------------------------------------------